<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/header :: header}">
</head>
    <body>

    <div class="container blog-content-container">
 
		<form>
			<h2 class="form-signin-heading">找回密码</h2>
			
			<div class="form-group col-md-5">
				<label for="username" class="col-form-label">账号</label>
				<input type="text" class="form-control" id="username" name="username" maxlength="50" placeholder="请输入您的账号账号">
	 
			</div>
			<div class="form-group col-md-5">
				<label for="email" class="col-form-label">邮箱</label>
				<input type="email" class="form-control" id="email" name="email" maxlength="50" placeholder="请输入您的注册邮箱">
			</div>
			<div class="form-group col-md-5">
				<div id="forget-submit" class="btn btn-primary">提交</div>
			</div>
		</form>
    </div> <!-- /container -->
	<div th:replace="~{fragments/footer :: footer}">...</div>
	<script>
		var start = 0;
		$("#forget-submit").click(function () {
            if((new Date().getTime()-start)<60*1000){
                toastr.error((60-parseInt((new Date().getTime()-start)/1000))+"s再试");
            }else{
                $.ajax({
					async:false,
                    url: '/sendUpdatePasswordEmail/',
                    data:{
                        "userName":$("#username").val(),
                        "email":$("#email").val()
                    },
                    success: function(data){
                        if (data.success) {
                            toastr.success(data.message);
                            start = new Date().getTime();
                        } else {
                            toastr.error(data.message);
                        }
                    },
                    error : function() {
                        toastr.error("error!");
                    }
                });
			}

        });
	</script>
    </body>
</html>